package com.base.common.properties;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.base.common.ConfigConstants;
import com.base.common.utils.ReadJarUtil;

/**
 * 加载config.properties
 * 
 * @author Kevin Colin
 *
 */
public class PushConfigLoad {
	private static Properties props = null;
	private static String propertiesPath = "push-config.properties";
	static {
		try {
			props = new Properties();
			InputStream inputStream = ReadJarUtil
					.getInputStream(propertiesPath);
			props.load(inputStream);
			inputStream.close();

		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void init() {
		ConfigConstants.CJY_APP_ID = props.getProperty("CJYAppID");
		ConfigConstants.CJY_APP_KEY = props.getProperty("CJYAppKey");
		ConfigConstants.CJY_APP_SECRET = props.getProperty("CJYAppSecret");
		ConfigConstants.CJY_MASTER_SECRET = props
				.getProperty("CJYMasterSecret");
		ConfigConstants.YGJ_APP_ID = props.getProperty("YGJAppID");
		ConfigConstants.YGJ_APP_KEY = props.getProperty("YGJAppKey");
		ConfigConstants.YGJ_APP_SECRET = props.getProperty("YGJAppSecret");
		ConfigConstants.YGJ_MASTER_SECRET = props
				.getProperty("YGJMasterSecret");
	}
}
